Parcellation

One of the main components of a Connectome is the Parcellation, which comprises a list of regions over which fibre tracts are summarised.

Connectomes.ParcellationType
Parcellation(path::String)

A Parcellation type containing information about the underlying parcellation used in a Connectome. It is simply a collection of Region types.

struct Parcellation
    regions::Vector{Region}
end

Example

julia> parc = Parcellation(Connectomes.connectome_path())
Parcellation with 83 regions
source

By default we use the Desikan-Killiany-Tourville (DKT) atlas, provided as standard by FreeSurfer. The parcellation is included within the main connectome file that ships with Connectomes.jl. We can load it like so:

using Connectomes

connectome_path = Connectomes.connectome_path()
"/home/runner/work/Connectomes.jl/Connectomes.jl/assets/connectomes/Connectomes-hcp-scale1.xml"

The parcellation can be loaded from the connectome_path in the following way.

parc = Parcellation(connectome_path)
Parcellation with 83 regions

A parcellation is simply a collection of Regions.

struct Parcellation
    regions::Vector{Region}
end

Where Regions comprise pertinent information relating to a given region.

struct Region
    ID::Int                 # DKT region ID number
    Label::String           # Region name
    Region::String          # Cortical or Subcortical
    Lobe::String            # Lobe the region belongs to
    Hemisphere::String      # Hemisphere the region belongs to
    x::Float64              # x coordinate 
    y::Float64              # y coordinate
    z::Float64              # z coordinate
end

parc can be numerically indexed to retrieve regions, either as a Int

parc[1]
Region 1: right lateralorbitofrontal

or a Vector{Int}, which will return a new Parcellation.

parc[[1, 2, 3]]
Parcellation with 3 regions

If we load a Makie backend, we can conveniently plot the parcellation. Let's say, we just want to plot the left side of the connectome. We can do the following.

using WGLMakie

left_parc = filter(x -> get_hemisphere(x) == "left", parc)

plot_parc(left_parc; resolution=(500, 350), view=:left)

API

Connectomes.RegionType
Struct
    ID::Int
    Label::String
    Cortex::String
    Lobe::String
    Hemisphere::String
    x::Float64
    y::Float64
    z::Float64
end
source
Connectomes.get_labelFunction
get_label(roi::Region)

Return the Label of a Region.

Example

julia>get_label(parc[1])
"lateralorbitofrontal"
source
Connectomes.get_lobeFunction
get_lobe(roi::Region)

Return the Lobe of a Region.

Example

julia>get_lobe(parc[1])
""frontal""
source
Connectomes.get_coordsFunction
get_coords(roi::Region)
get_coords(parc::Parcellation)

Return a Vector{Float64} of $(x, y, z)$ coordinates of a Region.

Example

>get_coords(parc[1])
3-element Vector{Float64}:
  25.00574653668548
  33.4624935864546
 -16.65079527963058

Return a Matrix{Float64} of coordinates for all Regions in the Parcellation.

Example

>get_coords(parc)
83×3 Matrix{Float64}:
 25.0057  33.4625  -16.6508
  ⋮   
source
Base.getindexFunction
Base.getindex(parc::Parcellation, idx::Int)
Base.getindex(parc::Parcellation, idx::Vector{Int})

Index the Parcellation by idx::Intand return the correspondingRegion`

Example

julia> parc[1]
Region 1: right lateralorbitofrontal

Slice the Parcellation by into subregions given by the idxs.

Example

julia> parc[[1, 2, 3]]
Parcellation with 3 regions
source
Base.lengthFunction
Base.length(parc::Parcellation)

Return the number of regions in the Parcellation

Example

julia> length(parc)
83
source